const userinfo = {
    userid: 0,
    owner: 0,
    ownername: '',
    company: 0,
    companyname: '',
    bank: 0,
    bankname: '',
    agent: 0,
    agentname: '',
    staff: 0,
    staffname: '',
    mobile: '',
    identity: 0,
    identityname: '',
    identitycode: '',
    logo: '',
    nickname: '',
    birthday: '',
    token: '',
    code: '',
};

const UPDATE = 'update_userinfo';

export default (state = userinfo, action) => {
    switch (action.type) {
        case UPDATE:
            return {...state, ...action.payload};
        default:
            return state;
    }
};

export const saveUserInfo = (payload) => {
    return {
        type: UPDATE,
        payload,
    };
};
